/*******************************************************************************
TilesetKit.h

	Author:		LiuDingXi
	e-mail:		liudx@gmail.com
	Date time:	2009-08-06

	Copyright (C) 2009
	All rights reserved.
	
*******************************************************************************/

#ifndef _TILESETKIT_H_
#define _TILESETKIT_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ximage.h"
#include "BaseParser.h"

class CTilesetKit : public CBaseParser
{
public:
	CTilesetKit();
	virtual ~CTilesetKit();

public:
	BOOL	Load(CArchive& ar);
	BOOL	Store(CArchive& ar);

	BOOL	Free();

public:
	int		m_nTx;
	int		m_nTy;

	int		m_nWidth;
	int		m_nHeight;

	struct TILE
	{
		int		nIdx;
		CxImage xImage;
		UINT	nFlags;
	};

	int		m_nTotal;
	TILE*	m_pTiles;

	CString m_szImage;
	CString	m_szFolder;

	BOOL	LoadImage(LPCTSTR p);

	TILE*	GetTile(int nIndex);

protected:
	void	SetTileFlag(LPCTSTR p);

public:
	int		m_nSelect;
	int		m_nCX;
	int		m_nCY;
	int		m_nCol;
	int		m_nRow;
};


#endif//_TILESETKIT_H_
